#ifndef _VIDEO_OSD_H_
#define _VIDEO_OSD_H_

#define OSD_SIZE_16 0
#define OSD_SIZE_24 1
#define OSD_SIZE_32 2
#define OSD_SIZE_48 3

#ifndef _WIN32
#define RGB(r, g, b) ((unsigned long)(((u8)(r) | ((unsigned short)((u8)(g)) << 8)) | (((unsigned long)(u8)(b)) << 16)))
#endif

class cls_video_osd
{

public:
    cls_video_osd(cls_video *p_video);
    ~cls_video_osd();

    void add_osd(ctx_image_data *img_osd, ctx_image_data *img_org); // add osd on yuv422

private:
    cls_video *video;

    u8 *font_lut[2][OSD_SIZE_48 + 1];
    void load_font(const char *path, u8 *&buffer);
    void free_fonts();

    int cols;
    int rows;
    u8 *img;
    void init_data(ctx_image_data *img_osd, ctx_image_data *img_org);
    string utf8_to_gb2312(const string &utf8);
    int add_rgb(char osd_info[], int x, int y, int size = OSD_SIZE_16, u32 color = RGB(255, 255, 255)); // 默认图像从左上开始存储
    int add_yuv422(char osd_info[], int x, int y, int size = OSD_SIZE_16, u32 color = RGB(255, 255, 255));
};

#endif //  _VIDEO_OSD_H_